package cn.edu.nwsuaf.studentcenter.pojo;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * StudentExamAnswer entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "student_exam_answer", catalog = "exam")
public class StudentExamAnswer implements java.io.Serializable {

	// Fields

	private StudentExamAnswerId id;
	private Student student;
	private ExamContent examContent;
	private String examItemAnswer;

	// Constructors

	/** default constructor */
	public StudentExamAnswer() {
	}

	/** minimal constructor */
	public StudentExamAnswer(StudentExamAnswerId id, Student student,
			ExamContent examContent) {
		this.id = id;
		this.student = student;
		this.examContent = examContent;
	}

	/** full constructor */
	public StudentExamAnswer(StudentExamAnswerId id, Student student,
			ExamContent examContent, String examItemAnswer) {
		this.id = id;
		this.student = student;
		this.examContent = examContent;
		this.examItemAnswer = examItemAnswer;
	}

	// Property accessors
	@EmbeddedId
	@AttributeOverrides({
			@AttributeOverride(name = "studentNo", column = @Column(name = "student_no", nullable = false, length = 50)),
			@AttributeOverride(name = "examPaperNo", column = @Column(name = "exam_paper_no", nullable = false, length = 50)),
			@AttributeOverride(name = "examItemNo", column = @Column(name = "exam_item_no", nullable = false, length = 50)) })
	public StudentExamAnswerId getId() {
		return this.id;
	}

	public void setId(StudentExamAnswerId id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "student_no", nullable = false, insertable = false, updatable = false)
	public Student getStudent() {
		return this.student;
	}

	public void setStudent(Student student) {
		this.student = student;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns({
			@JoinColumn(name = "exam_paper_no", referencedColumnName = "exam_paper_no", nullable = false, insertable = false, updatable = false),
			@JoinColumn(name = "exam_item_no", referencedColumnName = "exam_item_no", nullable = false, insertable = false, updatable = false) })
	public ExamContent getExamContent() {
		return this.examContent;
	}

	public void setExamContent(ExamContent examContent) {
		this.examContent = examContent;
	}

	@Column(name = "exam_item_answer", length = 1024)
	public String getExamItemAnswer() {
		return this.examItemAnswer;
	}

	public void setExamItemAnswer(String examItemAnswer) {
		this.examItemAnswer = examItemAnswer;
	}

}